Previous Up Next

Integers, Identifiers, and Special Notation

Integers are non-empty strings of digits 0-9. It is a lexer error if a literal integer constant is too big to be represented as a 32-bit signed integer. 32-bit signed integers range from -2,147,483,648 to +2,147,483,647. Cool integer constants are always non-negative, so valid integer constants range from 0 to 2,147,483,647.

Identifiers are strings (other than keywords) consisting of letters, digits, and the underscore character. Type identifiers begin with a capital letter; object identifiers begin with a lower case letter. Identifiers \(\it are\) case sensitive.

\(\bf self\) and \(\bf SELF\_TYPE\) are treated specially by Cool but are not treated as keywords. \(\bf self\) should be reported by the lexer as an identifier and \(\bf SELF\_TYPE\) should be reported by the lexer as a type. Both \(\it are\) case sensitive.

The special syntactic symbols (e.g., parentheses, assignment operator, etc.) are given in Figure 1.

Previous Up Next